bq: Is there no way that the existing field can be used?

In a word, "no". The indexed terms are being used for sorting. You
have a document
that has the title "aardvark zebra". The actual _tokens_ are
aardvark
zebra

solr/Lucene has no way of knowing whether these should be sorted by "a"
or "z".

The copyfield to a string type then sorting by that is a good idea, although
you may want to normalize the field (i.e. lowercase, remove punctuation,
possibly remove stopwords etc).

Best,
Erick

On Fri, Oct 30, 2015 at 3:27 PM, davidphilip cherian
<davidphilipcher...@gmail.com> wrote:
> You can create a copy field with string type and make it copy from this
> existing field, and sort on this new one.
> That way, you can still continue doing text search on existing one and sort
> on this new field.
>
>
>
>
>
> On Fri, Oct 30, 2015 at 3:04 PM, Brian Narsi <bnars...@gmail.com> wrote:
>
>> Is there no way that the existing field can be used?
>>
>>
>> On Fri, Oct 30, 2015 at 1:42 PM, Ray Niu <newry1...@gmail.com> wrote:
>>
>> > you should use string type instead of text if you want to sort
>> > alphabetically
>> >
>> > 2015-10-30 11:12 GMT-07:00 Brian Narsi <bnars...@gmail.com>:
>> >
>> > > I have a fieldtype setup as
>> > >
>> > > <fieldType name="txt_edgngrm" class="solr.TextField"
>> > positionIncrementGap=
>> > > "100"> <analyzer type="index"> <tokenizer class=
>> > > "solr.StandardTokenizerFactory"/> <filter class=
>> > > "solr.LowerCaseFilterFactory"/> <filter
>> > class="solr.EdgeNGramFilterFactory"
>> > > minGramSize="3" maxGramSize="25"/> </analyzer> <analyzer type="query">
>> <
>> > > tokenizer class="solr.StandardTokenizerFactory"/> <filter class=
>> > > "solr.LowerCaseFilterFactory"/> </analyzer> </fieldType>
>> > >
>> > >
>> > > When I sort on this field type in ascending order I am not getting
>> > results
>> > > sorted alphabetically as expected.
>> > >
>> > > Why is that?
>> > >
>> > > What should I do to get the sort on?
>> > >
>> > > Thanks
>> > >
>> >
>>

Reply via email to