Adding a new search field but needs searching for all

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding a new search field but needs searching for all

Chun Wei Ho
I have a large Lucene index that I am planning on adding one or more
search fields, and perform searches on them.

How do I include results from the other documents that do not have the
new field? For example, I have 10 million documents in a index, and I
update 200 of them adding the field "b" = 1, 100 of them with field
"b" = 2. How do I write a query such that I can specify "b" != 1 and
get 10million minus 100 (including the ones that do not have the field
"b"). Or do I have to update all the documents (potentially time
consuming since it means deleting and inserting each document in
turn??)?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Adding a new search field but needs searching for all

Erik Hatcher
Try a MatchAllDocsQuery combined in a BooleanQuery with a negative  
clause for b == 1.

        Erik


On May 10, 2006, at 5:32 AM, Chun Wei Ho wrote:

> I have a large Lucene index that I am planning on adding one or more
> search fields, and perform searches on them.
>
> How do I include results from the other documents that do not have the
> new field? For example, I have 10 million documents in a index, and I
> update 200 of them adding the field "b" = 1, 100 of them with field
> "b" = 2. How do I write a query such that I can specify "b" != 1 and
> get 10million minus 100 (including the ones that do not have the field
> "b"). Or do I have to update all the documents (potentially time
> consuming since it means deleting and inserting each document in
> turn??)?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]