logo
down
shadow

Custom field class in SOLR


Custom field class in SOLR

By : user2952912
Date : November 19 2020, 03:59 PM
Hope this helps Yes, you can create your own FieldType - there should however be very specific reasons to do so. The Solr backend is Lucene, so it'll be your own responsibility to marshal content between the Solr representation and the backing Lucene implementation.
Possible starting points could be the implementation of StrField in Solr (which is just a simple field in Lucene as well), or far more advanced examples such as LatLonType and PointField.
code :


Share : facebook icon twitter icon
Custom ranging in solr for custom field with websphere commerce

Custom ranging in solr for custom field with websphere commerce


By : Pallavi C
Date : March 29 2020, 07:55 AM
I wish this help you I gathered from your question that you have a number of inventories you have to check? So you need to return fulfillment IDs for product X where inventory is greater than zero? I assume then that product ID plus fulfillment ID is the unique key for your index?
If so then filtering for inventory should not be a problem. Inventory is an integer, right? So to filter on inventory you would simply add " inventory:[1 TO *] " to your filter query parameter ("fq" if you're using the Solr web service). Filtering on fulfillment IDs should work similarly, except you won't be using a range: " fulfillment_id:(11051 OR 11052) ". Does that help? Remember to use a "+" before each filter if you have multiple filter params. So your filter query may look like this: "fq=+inventory:[1 TO *] +fulfillment_id:(11051 OR 11052)".
Add a custom field type in solr

Add a custom field type in solr


By : Law
Date : March 29 2020, 07:55 AM
like below fixes the issue You can define new custom fields in solr by adding them to the schema.xml in the element:
code :
<fields>
...
<field name="newfieldname" type="text_general" indexed="true" stored="true" multiValued="true"/>
...
</fields>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>
Solr: Introduce a custom field in solr query response

Solr: Introduce a custom field in solr query response


By : Damir Ilicic
Date : March 29 2020, 07:55 AM
should help you out You can achieve this using a DocTransformer . Just inherit from the class and implement the required logic in the transform method :
code :
public void transform(SolrDocument doc, int docId) {
    String oldValue = doc.getFieldValue(fieldName);
    doc.put(newField,getNewValue(oldValue));
}
Solr (4.6.1) re-ordering by custom field value before response

Solr (4.6.1) re-ordering by custom field value before response


By : user3764071
Date : March 29 2020, 07:55 AM
it helps some times Use CustomScoreQuery and CustomScoreProvider. Add an integer priority field with values (high=3, medium=2, low=1) into your document in order to cache and use it in scoring computation.
code :
public class MyScoreProvider extends CustomScoreProvider {

    private FieldCache.Ints priorities;

    public MyScoreProvider(AtomicReaderContext context) throws IOException {
        super(context);
        priorities = FieldCache.DEFAULT.getInts(context.reader(), "priority_numeric", false);
    }

    public float customScore(int doc, float subQueryScore, float valSrcScore) {

        int segment = 100 / getSegmentNumber(subQueryScore);
        return segment + priorities.get(doc);

    }
}
solr facet with text field, how to stop solr tokenize it into separate tokens, I want to get the whole field result

solr facet with text field, how to stop solr tokenize it into separate tokens, I want to get the whole field result


By : andy
Date : March 29 2020, 07:55 AM
I wish this helpful for you I have a text field type named buyer, I need facet on the field. And get the whole value, nor separate tokens, how can I do? thanks a lot. eg, buyer field value are "beauty inc"、"markwins llc"、"products inc", this is facet result:
code :
<field name="buyer" type="text_general" indexed="true" stored="true"/>
<field name="buyer_facet" type="string" indexed="true" stored="false"/>

<copyField source="buyer" dest="buyer_facet"/>
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org