JavaScript Boolean Search Query Builder Interface Library? - javascript

Are there any (good/usable/not ugly) JavaScript/interface libraries for managing the creation of custom boolean style queries, similar to the Google Analytics Advanced Segment interface?
Basically, a dynamic interface for query building that can be used to connect to a custom query builder on the backend (in my case, MySQL, but it needn't be database specific).
I've searched around, and haven't found anything helpful or usable.

http://redquerybuilder.appspot.com/ is not pretty but aiming to be usable by non-techy people.
I should make it clear that I'm one of the authors of this project.

I found this question on the Elastic Search forum, that is very similar to yours. An elastic search js client library is suggested : http://elasticsearch-users.115913.n3.nabble.com/javascript-query-builder-td1860558.html .
ExtJS has a Query Builder extension to their Grid control: http://www.developerextensions.com/index.php/extjs-grid-query-builder (look for the link above the table that says Query Builder).
I also found this, "Active Query Builder": http://aspquerybuilder.net/default.aspx
The feature list is : http://www.activequerybuilder.com/featurematrix.html?show=asp . It's an paid ASP.NET component that uses jQuery. It's pretty robust and may be more than you are looking for and also may or may not be compatible with your framework (you didn't specify), but it does look pretty cool.
Some more ASP.NET-based query builders are linked from : Web based visual query builder.

Here is web-service I came across recently: Advangle.
Looks like they use a kind of JavaScript library with UI similar to what you requested.

A fairly new one is the jQuery QueryBuilder which can be found here: http://querybuilder.js.org/
It supports the following logical and filter operators:
and
or
equal / not equal
in / not_in
begins with / not begins with
contains / not contains
ends with / not ends with
is empty / is not empty
is null / is not null
less / less or equal /greater / greater or equal
between / not between
The basic output is JSON but plugins for SQL or MongoDB syntax import/export are available too.
Some demos can be found here: http://querybuilder.js.org/demo.html

There is also an MS Access like javascript visual sql query builder based on the Sencha ExtJS Framework. http://www.sencha.com/forum/showthread.php?208444-Ext.ux.window.VisualSQLQueryBuilder

Related

How does Bloodhound fit into typeahead.js?

I'm trying to understand how Twitters typeahead.js library works but I don't really understand what Bloodhound, the 'suggestion engine' does beyond acting as a source for the typeahead object.
Some of my concrete questions are:
What is a query? What is a datum? What do they look like and where do I get them from
Why do I need to tokenize my queries and datums?
What happens with the tokenized queries and datums?
I'd read the source code, but my Javascript is not that advanced ... The documentation is really unclear to me, as it's mostly examples and seems to be targeted at people who have implemented a typeahead in a specific way already.
If someone would be so kind to explain conceptually how it works I'd be very grateful.
Best regards,
Joshua
There is a detailed step-by-step Typeahead Tutorial #Digital Fortress with JS Fiddles to get you started with how Bloodhound and Typeahead work together.
Here are a few extracts from the Tutorial on what I deduced:
What is a query? A query is the text that the user types into the text box
What is a datum? A datum is a single suggestion. (A string)
Why do I need to tokenize my queries and datums? Tokenizing means to convert a string into an array of smaller strings (called tokens). It is done to ease searching operation. For example, take the string "hello super man". You can convert this string into 3 smaller strings by splitting them by the whitespace character. So, "hello super man" would become ["hello","super","man"] and would ease in searching for words beginning/containing hello, super and/or man.
What happens with the tokenized queries and datums? These are used by the Bloodhound engine to return suggestions to the user. Bloodhound matches the queries and the datums and returns the results as suggestions to the user.
Note: The official Typeahead library has NOT received any updates since 3+ years now(ref github). But there's an actively maintained fork (as of 2018) which should be used instead.
Reference

Natural Language Processing Database Querying

I need to develop natural language querying tool for a structured database. I tried two approaches.
using Python nltk (Natural Language Toolkit for python) using
Javascript and JSON (for data source)
In the first case I did some NLP steps to format the natural query by doing removing stop words, stemming, finally mapping keywords using featured grammar mapping. This methodology works for simple scenarios.
Then I moved to second approach. Finding the data in JSON and getting corresponding column name and table name , then building a sql query. For this one, I also implemented removing stop words, stemming using javascript.
Both of these techniques have limitations.I want to implement semantic search approach.
Please can anyone suggest me better approach to do this..
Semantic parsing for NLIDB (natural language interface to data bases) is a very evolved domain with many techniques: rule based methods (involving grammars) or machine learning techniques. They cover a large range of query inputs, and offer much more results than pure NL processing or regex methods.
The technique I favor is based on Feature based context-free grammars FCFG. For starters, in the NTLK book available online, look for the string "sql0.fcfg". The code example shows how to map the NL phrase structure query "What cities are located in China" into an SQL query "SELECT City FROM city_table WHERE Country="china" via the feature "SEM" or semantics of the FCFG.
I recommend Covington's books
NLP for Prloog Programmers (1994)
Prolog Programming in Depth (1997)
They will help You go a long way. These PDF's are downloadable from his site.
As I commented, I think you should add some code, since not everyone has read the book.
Anyway my conclusion is that yes, as you said it has a lot of limitations and the only way to achieve more complex queries is to write very extensive and complete grammar productions, a pretty hard work.

linkedin jsapi - people search with keywords ORed not ANDed

Is any ability to make a search using ORed parameters inside the keywords?
For instance, the request below fetching the 1st level connection with ANDed keywords - javascript, extjs, java.
IN.API.PeopleSearch()
.params({keywords: 'javascript extjs java', facet: 'network,F'})
.result(displaySearchedProfiles);
Looking for a way to use OR between the keys.
Yep, I got the same issue, but I seen that https://apigee.com service can retrieve everything. May be they uses another kind of api
Anyway thanks for your question
It looks like LinkedIn not provide ability to control queering string.

JavaScript client-side search engine

I am developing a local web application with jQuery/JavaScript.
My goal is to create search engine for searching content from a JSON file. I already made it with regex, but it works slowly.
What is the best way? Is there a JavaScript search engine?
Try lunr.js which supports full-text search in JavaScript.
The term "search engine" normally means that a large set of data is indexed (a resource intensive task). Searching the data set after indexing is then quick. If the data set is very large, it is more likely that indexing and search will be performed on the server (and only the search results are then returned to the browser).
If you just need to search fields in a JSON file that is small or medium in size, then consider JavaScript "search algorithms" rather than search engines.
Fuse.js is a lightweight fuzzy-search, in JavaScript, with zero dependencies. It has more github stars than Lunr, and has ongoing (and recent) commits as of August 2022.
I think it doesn't exist, you have developpe it
put your application contents in String object and developpe search function with indexOf (for target string) & substring (to extract fragment)
Have a look at fullproof, it's a basic search engine for use int he browser http://reyesr.github.com/fullproof/
There may be others though.
I think you have two options. Lunr that is mentioned earlier and search-index.
Elasticlunr is a lightweight full-text search engine in Javascript for browser search and offline search. Elasticlunr.js is developed based on Lunr.js, but more flexible than lunr.js.
Elasticlunr.js provides Query-Time boosting and field search. Elasticlunr.js is a bit like Solr, but much smaller and not as bright, but also provide flexible configuration and query-time boosting.

jQuery form generation

I'm basically looking for the client-side equivalent of Django's ModelForm: I want to be able to specify the general schema of my data (what the fields are, which ones are required, what kinds of fields to use, etc.), and I want to be able to dynamically generate the form, itself, fill it with any initial data, validate it, and extract an object containing the validated data that I can Ajaxily submit places when the form has been filled out.
Dos this exist? Something jQuery-flavored would be preferred.
You might also check out Alpaca (http://www.alpacajs.org). It's similar in some ways to Joshfire's JSON Form library. It uses JSON Schema and features a JSON-based way of specifying your layout and additional rendering options. It also uses templates for flexibility.
You can register your own controls for different data types. It comes with a whole bunch of controls already defined for things like simple text entry all the way to Google Maps and more.
Best of all, it's open-source and based on jQuery. It's been around for the better part of two years and we've been using it with Cloud CMS at my company. (disclaimer: I'm biased + I haven't tried any of the other tools suggested, they're likely awesome as well)
http://neyric.github.com/inputex/examples/json-schema.html
This is very likely what you want. Give YUI a whirl ;)
May I also humbly suggest Metawidget? It supports a broad range of back-end definitions and UI frameworks.
Joshfire's JSON Form library does just that.
It uses the IETF standard JSON Schema format to describe your models, and it can validate your data against it using JSV.
It lets you specify the form layout, but it generates a default form if you don't.
It's based on JQuery.

Categories