search

Home  >  Q&A  >  body text

设计模式 - Java怎么做到实时展示查询结果?

我们做的是Java客户端程序,想实现类似于ajax的实时、动态展示的效果。
比如一个查询,输入查询条件,根据输入的内容,动态的展示相关的结果。
有哪些好的解决方案?
开始我们设想的是 所有的字段都like一遍输入的内容,但是这样效率肯定会非常的差。
有没有高效的方法?

谢谢。

大家讲道理大家讲道理2780 days ago832

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-04-17 11:27:16

    If you want to implement search, you can use Lucene, which is faster than sql like.

    reply
    0
  • 迷茫

    迷茫2017-04-17 11:27:16

    1. Lucene
    2. Database full-text index
    3. Memory query

    reply
    0
  • 阿神

    阿神2017-04-17 11:27:16

    There may be a problem with this question itself. Ajax does not solve the performance problem, but the page is not refreshed. The specific response speed of the found results is the processing speed of the background. If you use a java application, you can communicate directly.

    I think we can improve the query speed from two aspects.
    1. If there are not many query conditions, for example, just search by title. Then, similar conditions can be placed in memory.
    2. If the query conditions are relatively large, use full-text search. Similar to Lucene mentioned above, of course, if you don’t have time to study too deeply, you can use
    solr, or sphinx, etc.

    reply
    0
  • Cancelreply