lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh Verma <>
Subject Custom FieldType not getting populated in the response
Date Thu, 28 Jun 2018 17:41:38 GMT
Hi All,

I am trying to fetch values (docValues to be exact) from external redis during query time
using a custom written FieldType which I am loading in my solr instance. I notice that my
custom FieldType is being initialized based on the schema when loading the core. I also notice
that during query time, my custom field type code is called but the results back from solr
do not populate the custom field even if I explicitly request it. Also, I am asking the results
to be sorted by the custom field but results are not sorted.

Solr version: 7.3.1
Here is my implementation:
Here is my  solrconfig.xml:
Here is my managed-schema:
Query that I am making: /solr/redis/select?fl=hits&q=*:*&sort=hits%20asc
Response that I get back:

Another query with debug flag: solr/redis/select?debugQuery=on&fl=*,hits&q=*:*&sort=hits%20desc
Sort order should be - 10, 9, 8, 6, 5, 4, 3, 2, 1, 7; because, corresponding hits value from
redis are - 11111, 900, 800, 600, 500, 400, 300, 200, 100, 7.

Can someone help me identify what am I missing?


Copy of discussion on #solr irc channel.

<harsh> I am trying to write a custom solr FieldType which fetches value from external
redis instance. I got Solr to load my custom jars and have defined the schema with custom
fieldType class. But at query time, I cannot get values in the response.
[08:38] <harsh> I do not see any errors in the logs as well, so cannot tell if something
[08:38] <harsh> here is the code for my custom FieldType -
[08:39] <harsh> this is my solrconfig.xml for my custom configset -
[08:42] <harsh> I basically placed the necessary jars under contrib/redis-field
[08:43] <harsh> and my managed-schema -
[08:43] <harsh> I am using solr version 7.3.1
[08:44] <harsh> any idea why I am not getting the value for my custom field type back?
[08:45] <@elyograg> harsh: I'm not familiar with the API to that level.  FYI, this should
go in #solr -- this channel is for development of Solr itself.
[08:46] <@elyograg> the field is not marked as stored.  I wonder if that might tell
Solr that it shouldn't be returned at all.  (I don't know whether setting stored=true might
require something more in your code, though)
[08:46] <harsh> I am using it as docValue, but I can try stored. Though, as you mentioned,
not sure if that would need more to be implemented in the code
[08:47] <harsh> I will try #solr channel for the question as well
[08:47] <@elyograg> ah, I didn't scroll to the right enough to see that part. :)
[08:48] <@elyograg> I wonder if you might need useDocValuesAsStored="true".
[08:49] <harsh> I thought that is the default value
[08:51] <harsh> for completeness, this is the query that I am using - /solr/redis/select?fl=hits&q=*:*&sort=hits%20asc
[08:52] <harsh> and response that I got back -
[08:53] == dataminion [] has joined #solr-dev
[08:53] <@elyograg> this one's probably going to need to go to the mailing list.  with
all the pastes you've mentioned here.
[08:57] == dataminion [] has quit [Ping timeout:
264 seconds]
[08:59] <@elyograg> you may be right about that being default.  The code in
seems to support that.
[09:00] <@elyograg>     if (schemaVersion >= 1.6f) properties |= USE_DOCVALUES_AS_STORED;
[09:02] <harsh> alright, thanks elyograg for looking into it. I will send this to mailing
list as well.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message