Using a multi-valued field in a display function

I am working on implementing Solr in a project, and now I'm stuck in a specific search, including the arr field. The fact is that:

I would like to search for a subdirection on an object, these subdirections are stored in a multi-valued field, for example:

<arr name="SubIds"> <int>12272</int> <int>12304</int> <int>12306</int> </arr> 

The request (or part of the request) that I want to use is as follows: Map (SubIds, I, I, 1,0)

When I, for example, fill 12304 in the "i" space in the map function above, I expect my function to return 1. If I entered 12345, it would have to return 0. The fact is that when I run this query returns 0, or "There is no number 12304 in this field, I return 0".

When removing 0 from my map function, I can see the actual value returned to me (when 12304 returns 1, when another returned value), in this case 12306! I tried this with several different ambiguous fields, but the result is the same; it seems like the function is checking the last value in a multi-valued field for my populated id.

It's true? And when this happens, is there a way to look at the entire arr and return only 0 when the value does not exist in the entire multi-valued field?

** Edit: this is just a hunch, but could it be that the map () function automatically arranges the arr list when it sees that all elements are of type int (for example). This may mean that the card returns the first number (the highest), which (in my example) would be 12306, not 12304 ... *

Thanks!

0
source share
1 answer

... It seems that functional queries do not work with multi-valued fields ...

http://lucene.472066.n3.nabble.com/Using-multivalued-field-in-map-function-td3318843.html#a3322023 :

Feature requests do not work with a multi-valued field. http://wiki.apache.org/solr/FunctionQuery#Vector_Functions

Given the following case, is there anyone who knows better how I can request the right data?

I have a website full of blog, and every blog has a blog owner, this owner is redirected through its identifier. For example: BloggerId = 123. It is also possible that there are several co-authors on the blog who are also mentioned there by BloggerId, but these identifiers are stored in a multi-valued field, in my previous SubIds example.

When you search for a specific blogger, you search BloggerId. The search results are affected by a number of variables, country / state / more specific geological data, blogcategory, etc. For this, I use a facet query. Next, I want to make some results more important, depending on BloggerId, I tried to do this using the following query:

?

d = display (amount (card (BloggerId, 12304.12304.2.0), card (BloggerId, 12304.12304.1.0)), 3.3.2) & amp {FUNC!}; = *, grade & facet.field = Country & f.Country.facet.limit = 6 & facet.field = status & FQ = (BlogCategory: internet% 20OR% 20BlogCategory: sport & sort = grade% 20desc, Top% 20desc ,% 20SortPriority% 20asc & start = 0 & omitHeader = true

In the resulting list, blogs written by BloggerId 12304 should be included at the top of the list, followed by blogs in which BloggerId 12304 was a co-author. After that, all other blogs that follow the criteria but are not written (or co-written) by BloggerId 12304.

Perhaps I could make this multi-valued field a string field (where id are separated by ";") and request my value, but if you have an idea, you will always be happy!

In the end, I decided to add a line with fields with spaces to separate different values. After that, I used the solr.WhitespaceTokenizerFactory class to quickly scan a string to find a specific identifier.

+1
source

All Articles