You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by George Abraham <ge...@gmail.com> on 2005/06/21 18:20:43 UTC
indexing values which might be null
Hi,
I am using Lucene to index database content. I have two questions:
1. Along with some of the fields that I want indexed, there are some
fields that I want stored (not indexed) in the index so as to return
with hits. However I also want to be able to sort a search result
using these non-indexed fields. Which method should I use in the Field
class then?
2. As is usual with some database content, sometimes fields that have
to be indexed turn out to be null. Using the Keyword method, the
indexing procedure gives me an error that 'value cannot be null'. How
do I then go about this?
Thanks,
George
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: indexing values which might be null
Posted by Robert Newson <rn...@connected.com>.
An approach I've used successfully is to add a separate field called
'empty' and include the names of other fields that are empty, e.g,
empty: subject
You can search for;
+empty:subject
for messages with empty (null) subjects.
This approach means you don't need to think of a magical value that (you
hope) doesn't match other legitimate values. Additionally, you only add
one new field to your index for any number of null-able fields.
B.
Otis Gospodnetic wrote:
> Hi George,
>
> A field value needs to be indexed if you want to sort by it - see
> http://www.lucenebook.com/search?query=index+for+sorting .
>
> As for null fields, you could use an empty string, or better yet, some
> "custom field value" that means "NULL" for your application.
>
> Otis
>
>
> --- George Abraham <ge...@gmail.com> wrote:
>
>
>>Hi,
>>I am using Lucene to index database content. I have two questions:
>>
>>1. Along with some of the fields that I want indexed, there are some
>>fields that I want stored (not indexed) in the index so as to return
>>with hits. However I also want to be able to sort a search result
>>using these non-indexed fields. Which method should I use in the
>>Field
>>class then?
>>2. As is usual with some database content, sometimes fields that have
>>to be indexed turn out to be null. Using the Keyword method, the
>>indexing procedure gives me an error that 'value cannot be null'. How
>>do I then go about this?
>>
>>Thanks,
>>George
>
>
>
> ____________________________________________________________________
> Simpy -- simpy.com -- tags, social bookmarks, personal search engine
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: indexing values which might be null
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi George,
A field value needs to be indexed if you want to sort by it - see
http://www.lucenebook.com/search?query=index+for+sorting .
As for null fields, you could use an empty string, or better yet, some
"custom field value" that means "NULL" for your application.
Otis
--- George Abraham <ge...@gmail.com> wrote:
> Hi,
> I am using Lucene to index database content. I have two questions:
>
> 1. Along with some of the fields that I want indexed, there are some
> fields that I want stored (not indexed) in the index so as to return
> with hits. However I also want to be able to sort a search result
> using these non-indexed fields. Which method should I use in the
> Field
> class then?
> 2. As is usual with some database content, sometimes fields that have
> to be indexed turn out to be null. Using the Keyword method, the
> indexing procedure gives me an error that 'value cannot be null'. How
> do I then go about this?
>
> Thanks,
> George
____________________________________________________________________
Simpy -- simpy.com -- tags, social bookmarks, personal search engine
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org