site:yourdomain.com searchterms #### my $index = KinoSearch::InvIndexer->new( analyzer => KinoSearch::Analysis::PolyAnalyzer->new(language => 'en'), invindex => $pathToIndex, # Create the index if it isn't already there. create => not(-e $pathToIndex/segments"), ); #### $index->spec_field(name => 'id', analyzed => 0, vectorized => 0); $index->spec_field(name => ‘section', analyzed => 0, vectorized => 0); $index->spec_field(name => 'url', indexed => 0, analyzed => 0, vectorized => 0); $index->spec_field(name => 'title', boost => 3, vectorized => 0); $index->spec_field(name => 'content'); #### my $doc = $index->new_doc; $doc->set_value(id => $record->{id} || ''); $doc->set_value(section => $record->{section} || ''); $doc->set_value(url => $record->{record} || ''); $doc->set_value(title => $record->{record} || ''); my $content = processContent($record->{content}); $doc->set_value(content => $content || ''); $index->add_doc($doc); #### $index->finish(optimize => 1); #### # Open the index my $index = KinoSearch::InvIndexer->new( analyzer => KinoSearch::Analysis::PolyAnalyzer->new(language => 'en'), invindex => $pathToIndex, ); # Create a highlighter My $highlighter = KinoSearch::Highlight::Highlighter->new(excerpt_field => 'content'); # Execute the search My $hits = $index->search($query); #### # Get the total hits my $count = $hits->total_hits; # Get the first 10 records $hits->seek(0, 10); # Generate previews $hits->create_excerpts(highlighter => $highlighter); while (my $result = $hits->fetch_hit_hashref) { … } #### $query = qq/+section:"$section" AND ($query)/; #### $index->delete_docs_by_term(KinoSearch::Index::Term->new(id => $record->{id}));