Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Creating a Query that matches Documents without a specific Field set?

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


benjamin.pasero at gmail

Feb 9, 2010, 9:04 AM

Post #1 of 2 (542 views)
Permalink
Creating a Query that matches Documents without a specific Field set?

Hi,

is there any way I can search for Documents that have a specific Field not set?

The use case is obvious: Consider you introduce a new field to your
documents but dont want to migrate all other documents,
how would you be able to write a Query that covers both old and new documents?

I was hoping that a simple TermQuery where the term value was set to
be an empty String would help me out but I was prooven
wrong.

Thanks for helping,
Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


iorixxx at yahoo

Feb 9, 2010, 9:21 AM

Post #2 of 2 (502 views)
Permalink
Re: Creating a Query that matches Documents without a specific Field set? [In reply to]

> is there any way I can search for Documents that have a
> specific Field not set?

Yes. If you are using QueryParser *:* -specificField:[* TO *]

> I was hoping that a simple TermQuery where the term value
> was set to be an empty String would help me out but I was prooven
> wrong.

org.apache.lucene.search.MatchAllDocsQuery combined with RangeQuery can do that if you are constructing your queries programmatically.




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.