Skip to content
janek42 edited this page Jul 27, 2022 · 24 revisions

FAQ

Where to ask my questions?

Questions

How do I add a source?

See contributing sources.

Can I do range queries?

Range queries are for example:

  • Return all results where the price is between 100$ and 200$.
  • Return all results where the date is between 7/3/1977 and 24/5/2011.

Picky can do it, although only on fixed ranges. See this blog post for more info.

So what you can do is have a fixed range around what one is searching for. To do it, you use the ranged_category method:

ranged_category :price, 50

This would – if someone searches for 83 – search from 33 to 133 (from -50 to +50 around the searched value).
You can apply the same idea to a date search, where you would use seconds. So

ranged_category :birthdate, 3600

would search inside a range of 3600 seconds, or 2 hours (-3600 to +3600 seconds around the searched value).

Is Picky one of the ghosts in Pacman?

Um. Picky doesn’t like to talk about his past. They’re good buddies now. It annoys him though that Pacman is much better at bowling.

How can I make Picky weigh certain results higher?

See weights option in Searches Configuration.

In short: Queries take an option, for example

:weights => { [:title, :author] => 3 }

that gives bonus points to the title-author combination. (6 is high, 0 is the default, -6 is a harsh penalty)

Note that the order is important: So [:title, :author] is not the same as [:author, :title]. If you find that people search title, then author much more often than author, title, then penalize the latter, and give bonus points to the former.

Note that even if you give it a penalty of -1’000’000, it will always appear in the results. Just at the end of all combinations. But Picky will never drop a combination. Octopuses don’t do that.

How can I make the indexing faster?

Currently, Picky uses as default a partial index (for * Queries, like “Yukihiro Matsu*”) a generator Partial::Substring.new(:from => -3) (negative numbers count from the end), which means that you will get a result when searching for:

  • “Yukihiro Matsumo”
  • “Yukihiro Matsumot”
  • “Yukihiro Matsumoto” (from the exact index)

It is intensive, generating an index for subtokens of e.g. Matsumoto. From -3 is not so hard on the indexer, but:
If you don’t need partial searching:

define_category(:title, :partial => Partial::None.new)

Like this you find only:

  • “Yukihiro Matsumoto”

Another option is one that starts from the e.g. fifth character:

define_category(:title, :partial => Partial::Substring.new(:from => 5))

That would yield:

  • “Yukihiro Matsu”
  • “Yukihiro Matsum”
  • “Yukihiro Matsumo”
  • “Yukihiro Matsumot”
  • “Yukihiro Matsumoto”

(Usually the negative value makes more sense)

Hope that helps! If you have the time, use Partial::Substring.new(:from => 1). It yields the best results, usually.

How do I set the language of the Picky Javascript front end?

The front end has 5 built-in languages: en, de, fr, it, ch.
It uses the lang attribute set in the html tag as a queue as to which language to use. en is default.

Contact me if you need more.