lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Paul_Murd...@emainc.com>
Subject How to perform a phrase "begins with" query?
Date Thu, 17 Sep 2009 16:29:59 GMT
Hi all,

 

Since you can't (and it doesn't make sense to) use wildcards in phrase
queries, how do you construct a query to get results for phrases that
begin with a certain set of terms?  Here are some theoretical
examples...

 

Example 1 - I have an index where each document contains the contents of
short stories.  I want to return each document that begins with the
words "Once upon a time".  I know this in not valid Lucene syntax, but
what I would like to do is query for "Once upon a time"*

 

Example 2 - I have an index where each document contains numbered test
results....say test 1 - test 5000.  I want to return each document where
the test starts with the number 5.  So the query here would be (again I
know this isn't valid) something like "test 5"*

 

How can this be accomplished?

 

Thanks

Paul  

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message