Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:42:43+00:00 2026-06-15T13:42:43+00:00

Lets say I want to create two separate indexes on something like BlogPosts, so

  • 0

Lets say I want to create two separate indexes on something like BlogPosts, so that I can do a quick search using one index (for autocomplete purposes for example) then use the other index for full blown search querying.

Is that something I can do with Tire?
so something like this (forgive me if its a little primitive)

class Post < ActiveRecord::Base
  include Tire::Model::Search
  include Tire::Model::Callbacks

   index_name 'autocomplete'
  mapping do
      indexes :title, :analyzer => 'my_ngram_analyzer'
  end

  index_name 'main'
  mapping do 
      indexes :title
      indexes :description
      indexes :author
      indexes :published_on
  end
end

where the callbacks know to add and remove new posts from the appropriate indexes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:42:44+00:00Added an answer on June 15, 2026 at 1:42 pm

    You can’t do this in Tire, setting two separate indices (and mappings) in one class with the mapping DSL method.

    It may be a good idea to use two separate indices, one for auto-completion, another for search. There’s a nice tutorial, StackOverflow answer and even an elasticsearch plugin to get you started.

    However, unless you have a lot of data, you’d be able to achieve that even with a single index, using the multi_field type, match query across multiple fields, and potentially an NGram based analyzer.

    Check out the Autocomplete with Tire tutorial which outlines the approach.


    Cross-post from https://github.com/karmi/tire/issues/531

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say that I have a drop down list that I want to create
Lets say I want to make a class myClass with two slots A and
Lets say I want to simulate a particle state, which can be normal (0)
Total newb R question, but here it is: lets say I want to create
Lets say that I have two tables. Table 1 is a list of vendors
Lets say I have two variables defining separate selectors, for example... var parent =
I have two custom objects, lets say Cat and Dog . I want to
I want to create some class that can calculate absolute or relative time period.
In sql server, I have two tables (lets say Person and School). I want
I have a domain (lets say www.domain.com) and I want one section of that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.