lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: prefix query search problem if a hyphen exist in the search word
Date Wed, 28 Nov 2007 19:37:26 GMT

: Search query is like this ttl:co-operative it returns more than 50 results,
: but if i convert the query like this ttl:co-operat* it  returns no result.
: again i entered a query ttl:11-amino it returns some results, then  changed
: the above query into ttl:11-amino* it will return some more results than
: previous query.

if you'd searched the FAQ for "prefix" you would have found this 

  Are Wildcard, Prefix, and Fuzzy queries case sensitive?

that may not seem like it relates to your problem, but if you read the 

  No, not by default. Unlike other types of Lucene queries, Wildcard, 
  Prefix, and Fuzzy queries are not passed through the Analyzer, which is 
  the component that performs operations such as stemming and lowercasing. 
  The reason for skipping the Analyzer is that if you were searching for 
  "dogs*" you would not want "dogs" first stemmed to "dog", since that would 
  then match "dog*", which is not the intended query. These queries are 
  case-insensitive anyway because QueryParser makes them lowercase. This 
  behavior can be changed using the setLowercaseExpandedTerms(boolean) 

...the key being that wildcard and prefix queries aren't analyzed, so if 
you are using an Analyzer that does something special with hyphens (like 
split on then perhaps) that would explain the behavior you are seeing.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message