Skip to content

Tips for working with Quepid

Eric Pugh edited this page Feb 6, 2024 · 28 revisions
  1. Did you know you can add multiple queries at once by separating them with a ; character? Go ahead and try out star wars;star trek in the Add Query field.
  2. When importing CSV files with special characters like á, make sure to use UTF-8 encoding.
  3. Want to disable the snippeting that Quepid does on a long field? Specify that you want the unabridged content via unabridged:body_text.
  4. You can add a thumbnail image to each document result via thumb:poster_path, this assumes you have the full url in the field poster_path in your document. If you have a RELATIVE url, then you can specify your http root via some json: {"name": "poster_path", "type":"thumb", "prefix": "https://www.example.org/images/thumbs"} in place of thumb:poster_path.
  5. You can add a larger image to each document result via image:poster_path, this assumes you have the full url in the field poster_path in your document. If you have a RELATIVE url, then you can specify your http root via some json: {"name": "poster_path", "type":"image", "prefix": "https://www.example.org/images"} in place of image:poster_path.
  6. If you have an audio/image/video URL, you can embed in in the result listing via media:field_name
  7. Sometimes you need to look at the original document. If your field value starts with the string http or https then it will be turned into a clickable link.
  8. Want to see the output of a function as a field? Just add the function name to the field list, like id title geodist() and the function will run. Sadly, aliasing field names isn't supported, like distance:geodist().
  9. Do you have a nested JSON document in your results like { "variants": [ { "name": "red" }, { "name": "blue" } ] }? Specify your field as variants.name and it will pluck out the values red,blue from the array. If you have { "actor": { "name": "bob hope", "id":52 } } you can do actor.name to just get the name.
  10. If you ever run into a situation with Quepid refusing to start / respond due to Unknown database: 'quepid', and you are using docker, it might be that the mysql database is not stored on the volume in the expected location (volumes/mysql_data/quepid) on your disk. Instead, it can be inside the docker image that had been running Quepid instance last. So, if you are not an expert in docker (like me), you can try your luck by grep'ing quepid in /var/lib/docker/volumes/. Something like this should do: grep -r quepid /var/lib/docker/volumes/. If grep outputs some files like quepid/, take a note of the path, cd in there and observe the directory. It should have the files like: ib_logfile1 performance_schema/ auto.cnf mysql/ ib_logfile0 ibdata1 quepid/ Copy these files and directories into the expected location like volumes/mysql_data/quepid and start your quepid application with mysql and redis.

Hacking Custom Scorers to CHANGE Search Result Presentation in Quepid!!!!

A crazy use of a custom scorer is to change the Quepid UI! Since a Custom Scorer is JavaScript, it can manipulate the actual Quepid site!

Here is an example of making a relative URL that is in your search engine document a fully qualified URL:

window.onclick = function(event) {
  if(event.target.classList.contains('toggleSign') || event.target.classList.contains('query')) {
    var url;
    $(".subLabel").each(function(){
      console.log("Here we are:" + $(this).text());
      
      if($(this).text().indexOf("relative_image_url") > -1 ) {        
        url = $(this).next().text();
        if(url !== undefined && url.indexOf("http") == -1) {
          $(this).next().html("<a target='_blank' href='https://i.imgur.com" + url +"'>https://i.imgur.com" + url + "</a>");
        }
      }
    });
  }
};

Here is an example of modifying the image thumbnail to provide a full link!

window.onclick = function(event) {
  //console.log(event.target.classList);
  if(event.target.classList.contains('toggleSign') || event.target.classList.contains('query')) {
    var imgUrl;
      $(".img-thumbnail").each(function(){
      imgUrl =  $(this).attr("src");
      if(imgUrl !== undefined && imgUrl.indexOf("http") == -1)
      {
          $(this).attr("src", "https://i.imgur.com" + $(this).attr("src"));
      }      
    });
  }
};

There are some blog posts that you may find valuable as well: