The sort is on a tokenized field. You'll likely need to sort on a string or
SortableTextField to get the correct ordering.

https://solr.apache.org/guide/8_6/field-types-included-with-solr.html


Joel Bernstein
http://joelsolr.blogspot.com/


On Wed, Sep 7, 2022 at 8:37 AM Netta Steinberg <nsteinb...@dalet.com> wrote:

> Hello all,
>
>
>
> I have 3 indexed items. Each item has a field named TITLE_Name_t. The
> TITLE_ Name_t value has the same prefix for all three items, but a
> different suffix.
>
> The values are:
>
> THE PROMISE YR. 2 (SVOD)_PX217330-M
>
> THE PROMISE YR. 2 (SVOD)_PX218328-M
>
> THE PROMISE YR. 2 (SVOD)_PX217328-M
>
> So the identical prefix is “THE PROMISE YR. 2 (SVOD)_PX”, and the
> difference is in the numerical part of each value.
>
> When I sort (ascending order) by the TITLE_ Name_t field, the order is as
> written above. The problem is that the item with the 218 part is between
> the two items whose number part contains 217. Since the prefix is identical
> until the numerical part, I would expect that the items would be ordered
> according to the numerical part (i.e. first 217328, then 217330, then
> 218328).
>
>
>
> In the schema, the TITLE_Name_t is defined as follows:
>
> <field name="TITLE_Name_t" type="textgen-ai" indexed="true" stored="true"
> omitNorms="false" multiValued="false" termVectors="true"
> termPositions="true"/>
>
>
>
> The textgen-ai type is defined as follows:
>
> <fieldType name="textgen-ai" class="solr.TextField"
> positionIncrementGap="1000">
>
>                 <analyzer type="index">
>
>                                 <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>
>                                 <filter
> class="solr.ASCIIFoldingFilterFactory"/>
>
>                                 <filter class="solr.StopFilterFactory"
> ignoreCase="true" words="stopwords.txt"/>
>
>                                 <filter
> class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="1" catenateNumbers="1"
> catenateAll="0" splitOnCaseChange="0"/>
>
>                                 <filter
> class="solr.LowerCaseFilterFactory"/>
>
>                 </analyzer>
>
>                 <analyzer type="query">
>
>                                 <tokenizer
> class="solr.WhitespaceTokenizerFactory"/>
>
>                                 <filter
> class="solr.ASCIIFoldingFilterFactory"/>
>
>                                 <filter class="solr.SynonymFilterFactory"
> synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
>
>                                 <filter class="solr.StopFilterFactory"
> ignoreCase="true" words="stopwords.txt"/>
>
>                                 <filter
> class="solr.WordDelimiterFilterFactory" generateWordParts="1"
> generateNumberParts="1" catenateWords="0" catenateNumbers="0"
> catenateAll="0" splitOnCaseChange="0"/>
>
> <filter class="solr.LowerCaseFilterFactory"/>
>
> </analyzer>
>
> </fieldType>
>
>
>
> Here’s a screenshot of the search in Solr Admin (hope it will appear in
> the forum. I also upload it to pasteboard -
> https://pasteboard.co/zs9W4a0dQrOi.png)
>
>
>
> Can someone please help me understand why the results are not ordered as I
> expect them to be?
>
>
>
> Thank you,
>
> Netta
>

Reply via email to