Wildcard search

Hello,

Is there any (easy) way I could get a wildcard search function working on my discourse?

I run a small closed discourse locally at work. It only has ~10 users so we are not talking post amount like a large community.

I saw this Algolia plugin wich seams like a perfect thing, BUT that means they need to index the forum and we can’t let that data leave the local network.

I want to find stuff like “DE322X” when I search for “322X” :slight_smile:

3 curtidas

There might be a couple of ways to do this using our Discourse Data Explorer Plugin.

  • You could run this simple query and then click the CSV button to download all posts. Then, you could search across the exported file using a different program.

    `SELECT id, raw from posts`
    

  • You could write a custom data explorer query to search for the keyword across all post content.

Using the Data Explorer here would ensure that your data doesn’t leave the local network.

3 curtidas

Thanks, I will save this for later. Might come in handly :slight_smile:
But for this I need the whole team to be able to search stuff and would be a real hassle if everyone needed to dump a CSV file every time to find what they need :confused:

1 curtida

Sure, then writing a custom query and seeing the results in the UI would be the way to go. See What cool data explorer queries have you come up with? for inspiration on writing queries.

2 curtidas

Em um site pequeno o suficiente, algo como isso poderia funcionar:

-- [params]
-- string :query

SELECT p.id AS post_id, 
       p.user_id
FROM posts p
WHERE p.raw ~* :query
  AND p.deleted_at IS NULL

Embora você pudesse talvez adicionar uma categoria específica ou um intervalo de datas se quisesse limitá-lo ainda mais.

Uma vez escrito, você pode torná-lo disponível para certos grupos usarem:


Embora eu aprecie que funcionar a partir da barra de pesquisa seja idealmente o que o OP está buscando. :slight_smile: Vou mover isso para Feature caso haja mais demanda por isso.