• Hello,

    I currently manage the e-shop of a store that sells books.
    We have over 35000 books.
    Each book have a unique ISBN code that is included in the description of each.
    The ISBN is in one of these 2 formats:
    1. 978-618-03-1750-3
    2. 9789601658810

    So, I want to be able to search for a product with the ISBN regardless of the dashes.

    For example if the product has as an ISBN this: 978-618-03-1750-3
    and I search the same numbers without the dashes: 9786180317503
    I wish to have as a result the book that has 978-618-03-1750-3 as an ISBN

    And the other way around.
    If the product has as an ISBN this: 9786180317503
    and I search the same numbers with the dashes: 978-618-03-1750-3
    I wish to have as a result the book that has 9786180317503 as an ISBN.

    I hope I dont get you confused by what I mean.

    Thanks in advance!!

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Mikko Saari

    (@msaari)

    No confusion, and this one’s simple: in the Settings > Relevanssi > Indexing > Advanced indexing settings, set “Hyphens and dashes” to “Remove” and then rebuild the index. This’ll do exactly what you need.

    Thread Starter misdim

    (@misdim)

    Thanks for the quick answer!!

    I found an older thread and I already tried that but nothing changed.
    And actually I don’t see any difference in the search results.
    The search seems to work exactly as before I installed the Relevanssi plugin.

    Plugin Author Mikko Saari

    (@msaari)

    Try the Relevanssi admin search (Dashboard > Admin search). Does that work correctly? If installing Relevanssi seems to have no effect, it’s possible your site search is not using Relevanssi.

    Do you have a live ajax search or a regular search where you load the search results page?

    Thread Starter misdim

    (@misdim)

    Just tried the admin search and its working perfectly.

    I have live ajax search.

    Plugin Author Mikko Saari

    (@msaari)

    Is the live ajax search from a plugin or a theme? If it’s from a plugin, can you switch to Relevanssi Live Ajax Search? If it’s from your theme, which theme are you using? Some themes let you replace the live ajax search provider so you can switch it to use Relevanssi; some are hard-coded so you can’t do anything about it.

    Thread Starter misdim

    (@misdim)

    Its from the theme.
    I am using Flatsome from UX Themes.

    Plugin Author Mikko Saari

    (@msaari)

    Flatsome ajax search may work, but sometimes requires a bit of code. See here for more information.

    function rlv_flatsome_search_function( $query, $args, $defaults ) {
      $args['relevanssi'] = true;
      return get_posts( $args );
    }
    
    add_filter( 'flatsome_ajax_search_function', function() { return 'rlv_flatsome_search_function'; } );
    Thread Starter misdim

    (@misdim)

    Great!! Just added the code and it seems to work.
    There is only one problem. When I type 978-618-03-1750-3 with or without dashes it brings out the right book as the firtst result but bellow it, it also brings all the books that their ISBN starts with 978-618-03

    Plugin Author Mikko Saari

    (@msaari)

    If you don’t want partial matching, set the Keyword matching setting in Relevanssi to “whole words”.

    Thread Starter misdim

    (@misdim)

    Already did that but nothing changed.

    Thread Starter misdim

    (@misdim)

    Actually it shows in the results 101 books no matter what I type on search.
    Even if I search by title, it shows the right one on top and 100 more books bellow.

    Plugin Author Mikko Saari

    (@msaari)

    On the search results page? That’s probably something with Flatsome, and has nothing to do with Relevanssi. Flatsome search results page has some extra search results added.

    Thread Starter misdim

    (@misdim)

    Not at the results page. At the live results during typing.
    Before adding the code that you send me, when i typed a book title, it showed only the right match and some books that contained the same words.

    Plugin Author Mikko Saari

    (@msaari)

    I don’t know; you should get the same results as you get from the Relevanssi admin search. Do you? Do you see the wrong results there as well?

    Thread Starter misdim

    (@misdim)

    At the admin search I just tried a title of a book and i get 4 results.
    At the frontsite’s search i get the same number at the search results page but at the live results i get more than 100

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Search description with or without dashes’ is closed to new replies.