Solved

Solr - Can't get Field Boosts to work with Date Function

Posted on 2014-04-15
5
414 Views
Last Modified: 2014-04-22
In Solr, I have a date function to boost more recent records and multiply by a few custom variables.  This works fine:
{!boost b=product(.5,sum(div(max(sub(4,div(ms(NOW,releaseDate),31557600000)),0),4),.6),RatingFactor,PriorityFactor)} apples

I now want to boost a field in conjunction with my query, but the field boost (qf=title^3) does not seem to do anything with my query above.  When I remove the formula from my query and just search q=apples, then the (qf=title^3) boost DOES work.  Does anyone know why these aren't working in conjunction?  Thanks -
0
Comment
Question by:Xbradders
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 40003900
couple of questions

what is the field type of title?
what term are you searching? multiple words? single words? both?
0
 

Author Comment

by:Xbradders
ID: 40004997
I've tried setting the title field type as text and string but can't get the desired result.  I've tried putting my title field it in the 'text' copy field and it's own field, and also tried removing it from the 'text' copy field, thinking that it would boost more, and am having no luck.

I need to be able to search multiple terms and single words.  If an exact match is found in title, I want that record to be returned 1st.  I've tried the query below, searching for title "crazy shoes".  It's actually being returned 9th out of 9 records.  

When I put the title in quotes, Solr does find it, but it then does not tokenize obviously, and only returns the one record.  I'd like it to return all 9 records, with the title "crazy shoes" first.  Is there some way I should be doing both?

http://99.999.99.999:8080/solr/tracks_collection/select?q={!boost%20b=$dateboost%20v=$qq%20defType=dismax}&dateboost=recip(ms(NOW,releaseDate),3.16e-11,1,1)&fl=text,releaseDate,track_title,language,score&qf=title^99 language^2 text&&qq=crazy shoes
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
ID: 40005057
what i have done is indexed certain fields as both text and string
title_t is text version of the title and title_s is the string version,

i then search both

i do a couple of processes to tokenize any search strings submitted but if a quoted term is submitted i search specifically for that and do not break it down, and i do full search and tokenized search, seems to work pretty well
0
 

Author Comment

by:Xbradders
ID: 40013107
Thanks for the help so far.  I can award the points and break off a new thread if needed, because I now have follow-up questions, so let me know.  

I've followed your suggestion and created a separate string field for track_title_str, and am trying to use the q.alt to query this with my search terms in quotes.  I'm then trying to boost that field (heavily in this example), but it doesn't seem to work.

http://99.999.99.999:8080/solr/tracks/select?q=crazy+shoes&fl=track_title%2C+text&wt=json&indent=true&defType=edismax&q.alt=%22crazy+shoes%22&qf=track_title_str^222+text&stopwords=true&lowercaseOperators=true
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 40014600
hi,

While i am happy to take points, ;) you should request that this question be reopened as your issue has not been fully resolved, and you have follow-up questions.

thanks

jester
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now