Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: kinosearch: discuss

How to easily disable SimpleHTMLEncoder in Highlighter & How to boost field

 

 

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded


vladaman at gmail

Apr 10, 2008, 11:19 PM

Post #1 of 2 (844 views)
Permalink
How to easily disable SimpleHTMLEncoder in Highlighter & How to boost field

Hello guys,

1) can you help me how to disable SimpleHTMLEncoder? I have issues
with UTF-8 Characters encoded into html entities and I don't want
that. Is there any quick and dirty trick?

2) I also have a question, how to boost some fields in the search
results. For example Title. I know this was discussed before but it's
related to older version. Do I have to alter Schema or can I boost it
with Searcher?

I created Schema/Category.pm but I am not sure if this works. Score is
still the same.

package Schema::Category;
use base qw( KinoSearch::FieldSpec );

sub analyzed { 0 }
sub indexed { 1 }
sub stored { 1 }
sub vectorized { 1 }
sub binary { 0 }
sub compressed { 0 }

sub boost { 2 }

1;


I am using version 0.20_051

--
Vladimir Vlach
http://www.linkedin.com/in/vladaman

_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch


marvin at rectangular

Apr 11, 2008, 11:12 AM

Post #2 of 2 (775 views)
Permalink
Re: How to easily disable SimpleHTMLEncoder in Highlighter & How to boost field [In reply to]

On Apr 10, 2008, at 11:19 PM, Vladimir Vlach wrote:
> 1) can you help me how to disable SimpleHTMLEncoder?

In 0.20_051, you subclass KinoSearch::Highlight::Encoder and override
encode():

package MyEncoder;
use base qw( KinoSearch::Highlight::Encoder );

sub encode { return shift }

package main;

my $highlighter = KinoSearch::Highlight::Highlighter->new(
encoder => MyEncoder->new,
);
...

For future reference, in svn trunk you subclass Highlighter itself:

package MyHighlighter;
use base qw( KinoSearch::Highlight::Highlighter );

sub encode { return shift }

package main;

my $highlighter = MyHighlighter->new(
searchable => $searcher,
query => $query,
field => 'content',
);
...

> 2) I also have a question, how to boost some fields in the search
> results. For example Title. I know this was discussed before but it's
> related to older version. Do I have to alter Schema or can I boost it
> with Searcher?

It's possible, though it requires a bit of complex manual
intervention. Basically, you have to prepare a complex query and
boost part of it.

However, I think you can solve the problem another way.

> I created Schema/Category.pm but I am not sure if this works. Score is
> still the same.

Note that because you've indicated for the field not to be analyzed,
only an exact match counts:

> sub analyzed { 0 }

Such an exact match unlikely to be produced by a QueryParser. For
example, if the category was "travel books", and you feed the query
'travel books' into QueryParser, it will parse that into a search for
"travel" plus a search for "books", neither of which will match the
complete value "travel books".

If you change for the category field to be "analyzed", it would match,
though, and I bet you'd see a change in the score. Either that, or
you can change how you're building the query to go after exact matches.

> sub boost { 2 }

You might also try a higher boost, just for the sake of verifying that
it isn't having an effect. To keep down index size, boost is stored
with extremely coarse resolution. Sometimes a sensible boost value
like 2 doesn't cross a threshold and trigger a change in one
particular score.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


_______________________________________________
KinoSearch mailing list
KinoSearch [at] rectangular
http://www.rectangular.com/mailman/listinfo/kinosearch

kinosearch discuss RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.