Search results with phrase

Hi all! this is my first post here,

I’m starting to use Algolia for my project, but I got stuck right away.

I’d like to have an extended search like this:

For example if user search: “I want a beatiful jeans”, in my results soulde be include
“jeans”, “blue jeans”, “red jeans”.

What is settings for this?
thanks!

Hi @cloude welcome to the community.

Sounds like you are trying to detect a user’s intent. This enables you to set conditions such as beautiful and consequences such as filtering based on colour. You might find Algolia’s filter by color example a handy starting point.

1 Like

I’m reading documentation, for use rules, but there is no explanation to implement this code in Laravel.

Where I’ll use it, into a model, a controller or in a fuction?

$rule = array(
  'objectID' => 'red-color',
  'conditions' => array(array(
    'pattern' => 'red',
    'anchoring' => 'contains'
  )),
  'consequence' => array(
    'params' => array(
      'query' => array(
        'remove' => 'red'
      ),
      'filters' => 'color:red'
    )
  )
);

// Push Rule to index
$index->saveRule($rule);

thanks for help!

Unfortunately Laravel is not something I am familiar with. You might look to adding rules via your dashboard instead of via code.

1 Like

ok, thank you for help :slight_smile: