Getting error on a specific query

full-text-search, hibernate, hibernate-search, lucene

Solution

'a' is a stopword, and will be filtered out of your query by the StandardAnalyzer. Stopwords are words which are common enough in the language your searching in, and are not deemed meaningful to generating search results. It's a short list, but 'a' is one of them in English.

Since the Analyzer has got rid of that term, and it was the only term present, you now are sending an empty query, which is not acceptable, and searching fails.

For the curious, these are the standard Lucene english stopwords:

"a", "an", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with"

If you don't want stop words to be removed, then you should set up your `Analyzer` without a `StopFilter`, or with an empty stop word set. In the case of `StandardAnalyzer`, you are able to pass in a custom stop set to the constructor:

Analyzer analyzer = new StandardAnalyzer(CharArraySet.EMPTY_SET);

Problem

Novice on Lucene here. I'm using it with Hibernate in a java client, and have been getting this error on a particular query: ``` HSEARCH000146: The query string 'a' applied on field 'name' has no meaningfull tokens to be matched. Validate the query input against the Analyzer applied on this field. ``` Search works fine for all other queries, even with empty resultset. My testing DB does have this record with 'a'. What could be wrong here?

Original source

Related problems