Nathan Ridley
Nathan Ridley

Reputation: 34426

Lucene range query - how to query for a string range with no specific upper maximum?

I'd like to perform a range query with Lucene. Normal syntax is along the lines of:

{Aida TO Carmen}

How do I structure a query such that all values above the minimum are acceptable? I'm using Lucene.Net (2.9.2)

Upvotes: 2

Views: 2233

Answers (2)

Robin
Robin

Reputation: 21894

Looks like in Java, you can set the upper bound as null, and it should work: http://www.gossamer-threads.com/lists/lucene/java-dev/22758

I'm personally using Tire in Rails, and I have no idea how to achieve this.

Upvotes: 1

Mr Lou
Mr Lou

Reputation: 1817

Before lucene 3.x,You can use RangeQuery like following:

QueryParser queryParser = new QueryParser(whichField, new StandardAnalyzer());
Query query = queryParser.parse(searchString);

see the tutorial for more details:http://www.avajava.com/tutorials/lessons/how-do-i-perform-a-range-query.html

How do I perform a range query?

Lucene RangeQuery syntax

Upvotes: 0

Related Questions