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 Michael Prichard <mi...@mac.com> on 2008/01/08 19:22:59 UTC
Sorting on tokenized fields
Is it possible to sort on a tokenized field? For example, I break
email address into pieces, i.e.
michael.prichard@email.com
becomes
michael.prichard@email.com
michael.prichard
michael
prichard
email.com
email
so when sorting on this field I get some strange results. Do I need
to create another field just for sorting? Or are there other ways to
do it?
Thanks!
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorting on tokenized fields
Posted by Michael Prichard <mi...@mac.com>.
yes, no worries.
i just check in advance what fields are available and build the Sort
object accordingly. Eventually BCC would be there...but not
necessary so at first.
Anyway, got it to work! Thanks for your help.
All the best,
Michael
On Jan 8, 2008, at 4:37 PM, Doron Cohen wrote:
> Hi Michael, I think you mean the exception thrown when you
> search and sort with a field that was not yet indexed:
>
> RuntimeException: field "BBC" does not appear to be indexed
>
> I think the current behavior is correct, otherwise an application
> might (by a bug) attempt to sort by a wrong field, that not only
> does not exist yet but will never exist. To prevent hidden bugs
> cases like this it is important to throw an exception in this case.
> Do you agree?
>
> On Jan 8, 2008 11:21 PM, Michael Prichard
> <mi...@mac.com> wrote:
>
>> Meaning that it says "field is not indexed". Where is
>> sortMissingLastAttribute?
>>
>> thanks.
>>
>> On Jan 8, 2008, at 4:13 PM, Ryan McKinley wrote:
>>
>>> what do you mean by "fail"? -- there is the sortMissingLast
>>> attribute
>>>
>>>
>>> Michael Prichard wrote:
>>>> ok... i should read the manual more often.
>>>> i went ahead and just added untokenized, unstored sort fields....
>>>> question, if I put a field in to sort of but say I have not
>>>> indexed any as of yet...will the Sort fail? For example, say I
>>>> have a BCC field and nothing has been indexed with that yet....I
>>>> run a sort on BCC.....I think it fails now...anyway around that?
>>>> On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
>>>>> Is it possible to sort on a tokenized field? For example, I
>>>>> break email address into pieces, i.e.
>>>>>
>>>>> michael.prichard@email.com
>>>>>
>>>>> becomes
>>>>>
>>>>> michael.prichard@email.com
>>>>> michael.prichard
>>>>> michael
>>>>> prichard
>>>>> email.com
>>>>> email
>>>>>
>>>>>
>>>>> so when sorting on this field I get some strange results. Do I
>>>>> need to create another field just for sorting? Or are there
>>>>> other ways to do it?
>>>>>
>>>>> Thanks!
>>>>> Michael
>>>>>
>>>>> ------------------------------------------------------------------
>>>>> --
>>>>> -
>>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>>>
>>>> -------------------------------------------------------------------
>>>> --
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorting on tokenized fields
Posted by Doron Cohen <cd...@gmail.com>.
Hi Michael, I think you mean the exception thrown when you
search and sort with a field that was not yet indexed:
RuntimeException: field "BBC" does not appear to be indexed
I think the current behavior is correct, otherwise an application
might (by a bug) attempt to sort by a wrong field, that not only
does not exist yet but will never exist. To prevent hidden bugs
cases like this it is important to throw an exception in this case.
Do you agree?
On Jan 8, 2008 11:21 PM, Michael Prichard <mi...@mac.com> wrote:
> Meaning that it says "field is not indexed". Where is
> sortMissingLastAttribute?
>
> thanks.
>
> On Jan 8, 2008, at 4:13 PM, Ryan McKinley wrote:
>
> > what do you mean by "fail"? -- there is the sortMissingLast attribute
> >
> >
> > Michael Prichard wrote:
> >> ok... i should read the manual more often.
> >> i went ahead and just added untokenized, unstored sort fields....
> >> question, if I put a field in to sort of but say I have not
> >> indexed any as of yet...will the Sort fail? For example, say I
> >> have a BCC field and nothing has been indexed with that yet....I
> >> run a sort on BCC.....I think it fails now...anyway around that?
> >> On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
> >>> Is it possible to sort on a tokenized field? For example, I
> >>> break email address into pieces, i.e.
> >>>
> >>> michael.prichard@email.com
> >>>
> >>> becomes
> >>>
> >>> michael.prichard@email.com
> >>> michael.prichard
> >>> michael
> >>> prichard
> >>> email.com
> >>> email
> >>>
> >>>
> >>> so when sorting on this field I get some strange results. Do I
> >>> need to create another field just for sorting? Or are there
> >>> other ways to do it?
> >>>
> >>> Thanks!
> >>> Michael
> >>>
> >>> --------------------------------------------------------------------
> >>> -
> >>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >>> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: Sorting on tokenized fields
Posted by Ryan McKinley <ry...@gmail.com>.
my mistake, I thought I was looking at the solr mailing list ;)
If you change your analyzer, it does not change the tokens that are
already in the index -- you will need to re-index for any changes to
take effect.
ryan
Michael Prichard wrote:
> Meaning that it says "field is not indexed". Where is
> sortMissingLastAttribute?
>
> thanks.
>
> On Jan 8, 2008, at 4:13 PM, Ryan McKinley wrote:
>
>> what do you mean by "fail"? -- there is the sortMissingLast attribute
>>
>>
>> Michael Prichard wrote:
>>> ok... i should read the manual more often.
>>> i went ahead and just added untokenized, unstored sort fields....
>>> question, if I put a field in to sort of but say I have not indexed
>>> any as of yet...will the Sort fail? For example, say I have a BCC
>>> field and nothing has been indexed with that yet....I run a sort on
>>> BCC.....I think it fails now...anyway around that?
>>> On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
>>>> Is it possible to sort on a tokenized field? For example, I break
>>>> email address into pieces, i.e.
>>>>
>>>> michael.prichard@email.com
>>>>
>>>> becomes
>>>>
>>>> michael.prichard@email.com
>>>> michael.prichard
>>>> michael
>>>> prichard
>>>> email.com
>>>> email
>>>>
>>>>
>>>> so when sorting on this field I get some strange results. Do I need
>>>> to create another field just for sorting? Or are there other ways
>>>> to do it?
>>>>
>>>> Thanks!
>>>> Michael
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorting on tokenized fields
Posted by Michael Prichard <mi...@mac.com>.
Meaning that it says "field is not indexed". Where is
sortMissingLastAttribute?
thanks.
On Jan 8, 2008, at 4:13 PM, Ryan McKinley wrote:
> what do you mean by "fail"? -- there is the sortMissingLast attribute
>
>
> Michael Prichard wrote:
>> ok... i should read the manual more often.
>> i went ahead and just added untokenized, unstored sort fields....
>> question, if I put a field in to sort of but say I have not
>> indexed any as of yet...will the Sort fail? For example, say I
>> have a BCC field and nothing has been indexed with that yet....I
>> run a sort on BCC.....I think it fails now...anyway around that?
>> On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
>>> Is it possible to sort on a tokenized field? For example, I
>>> break email address into pieces, i.e.
>>>
>>> michael.prichard@email.com
>>>
>>> becomes
>>>
>>> michael.prichard@email.com
>>> michael.prichard
>>> michael
>>> prichard
>>> email.com
>>> email
>>>
>>>
>>> so when sorting on this field I get some strange results. Do I
>>> need to create another field just for sorting? Or are there
>>> other ways to do it?
>>>
>>> Thanks!
>>> Michael
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorting on tokenized fields
Posted by Ryan McKinley <ry...@gmail.com>.
what do you mean by "fail"? -- there is the sortMissingLast attribute
Michael Prichard wrote:
> ok... i should read the manual more often.
>
> i went ahead and just added untokenized, unstored sort fields....
>
> question, if I put a field in to sort of but say I have not indexed any
> as of yet...will the Sort fail? For example, say I have a BCC field and
> nothing has been indexed with that yet....I run a sort on BCC.....I
> think it fails now...anyway around that?
>
> On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
>
>> Is it possible to sort on a tokenized field? For example, I break
>> email address into pieces, i.e.
>>
>> michael.prichard@email.com
>>
>> becomes
>>
>> michael.prichard@email.com
>> michael.prichard
>> michael
>> prichard
>> email.com
>> email
>>
>>
>> so when sorting on this field I get some strange results. Do I need
>> to create another field just for sorting? Or are there other ways to
>> do it?
>>
>> Thanks!
>> Michael
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Sorting on tokenized fields
Posted by Michael Prichard <mi...@mac.com>.
ok... i should read the manual more often.
i went ahead and just added untokenized, unstored sort fields....
question, if I put a field in to sort of but say I have not indexed
any as of yet...will the Sort fail? For example, say I have a BCC
field and nothing has been indexed with that yet....I run a sort on
BCC.....I think it fails now...anyway around that?
On Jan 8, 2008, at 1:22 PM, Michael Prichard wrote:
> Is it possible to sort on a tokenized field? For example, I break
> email address into pieces, i.e.
>
> michael.prichard@email.com
>
> becomes
>
> michael.prichard@email.com
> michael.prichard
> michael
> prichard
> email.com
> email
>
>
> so when sorting on this field I get some strange results. Do I
> need to create another field just for sorting? Or are there other
> ways to do it?
>
> Thanks!
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org