Re: [SolrNet] How can i boost a field dynamically at index time using solrnet

253 views
Skip to first unread message

Mauricio Scheffer

unread,
Feb 28, 2013, 10:58:49 PM2/28/13
to sol...@googlegroups.com
Here are the options I can think of:

1. Index using a Dictionary<string,object> document type as described in https://groups.google.com/d/topic/solrnet/iZlaw7Yn4_U/discussion

2. Resolve IReadOnlyMappingManager from the IoC container. Locate the field you want to boost using GetFields(). Mutate the SolrFieldModel's Boost property as needed for each document you add. This would preclude the parallelization of the indexing process.

3. Replace the default ISolrDocumentSerializer<T> with your own (using the default one as reference for your implementation).

1. and 2. are quite hackish. 3. is the cleanest solution, but may require a bit more code.

Cheers



--
Mauricio


On Tue, Feb 26, 2013 at 8:26 AM, Pragyanshis Pattanaik <pragy...@gmail.com> wrote:
Hi,

Currently for index time field boosting i am using mapping attribute and giving a static boost like below.

    [SolrUniqueKey("StudentID")]
     public int JobseekerID { get; set; }
    [SolrField("FName")]
     public string FName { get; set; }
    [SolrField("LName")]
     public string LName { get; set; }
    [SolrField("Subject"),Boost=50]
     public string Subject { get; set; }
    [SolrField("SubjectRating")]
     public string SubjectRating { get; set; }


Is there a way i can give the boost dynamically ?

For example I will calculate the boost according to SubjectRating and apply that value to boost the subject field ?

Or using reflection i have to change the attribute value ?

Please guide me.


Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "SolrNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrnet+u...@googlegroups.com.
To post to this group, send email to sol...@googlegroups.com.
Visit this group at http://groups.google.com/group/solrnet?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Pragyanshis Pattanaik

unread,
Mar 1, 2013, 2:12:01 AM3/1/13
to sol...@googlegroups.com
I have already followed the second approach and achieved what i wanted but will definitely give a try to third approach.

Thanks
--Pragyanshis
Reply all
Reply to author
Forward
0 new messages