Giter VIP home page Giter VIP logo

Comments (3)

alterhu2020 avatar alterhu2020 commented on May 5, 2024

I had used the below code to search the result from your code ,but It cannot search the result firstly the "contentProvider" object is empty,but if you invoked these code secondly ,it will get the search result .it's very strange .

QuickTextQuery newFilter = createFilter();
System.out.println("search content is:"+newFilter);
if (this.searcher==null) {
if (!newFilter.isTrivial()) {
searcher = new QuickTextSearcher(newFilter, context.createPriorityFun(), new QuickTextSearchRequestor(){
@OverRide
public void add(LineItem match) {
System.out.println("QuickTextSearchRequestor add function..."+contentProvider.getNumberOfElements());
contentProvider.add(match);
smallProvider.add(match);
myitem.add(match);
contentProvider.refresh();
}

                        @Override
                        public void clear() {
                            System.out.println("QuickTextSearchRequestor clear function...");
                            contentProvider.reset();
                            contentProvider.refresh();
                        }
                        @Override
                        public void revoke(LineItem match) {
                             System.out.println("QuickTextSearchRequestor revoke function...");
                             contentProvider.remove(match);
                             contentProvider.refresh();
                        }
                        @Override
                        public void update(LineItem match) {
                            contentProvider.refresh();
                        }
                  });


         }
      }else {
            //The QuickTextSearcher is already active update the query
            this.searcher.setQuery(newFilter);
       }

       if (progressJob!=null) {
            progressJob.schedule();
        } 
     System.out.println("content find is:"+contentProvider.getNumberOfElements()+",content are :\n"+contentProvider.items.toString());

from eclipse-integration-commons.

kdvolder avatar kdvolder commented on May 5, 2024

The quick text searcher is 'asynchronous' and adds and removes results to
the search requestor over time. There never is a final 'result'.
The responsibility of the SearchRequestor is to update the evolving results
in the UI as they arrive or get revoked.
So you can not perform a search and get 'the result'.

I think your test code launches a search and then immediately prints the
number of results once.
So it really only prints the few results that have already been found in
the few milliseconds since the
result got started. The search is still running and would find more results
later if you let it.

If you want to have a more meaningful test, you should keep the quickserach
object alive (i.e. not call
'cancel' on it and print the number of results in your contentProvider each
time it changes
(i.e. each time 'add', 'update', 'revoke' or 'clear' is called on the
requestor.)

You should see more results getting added over time.

If you change the query the live results will be updated (i.e. depending on
the query change
either the results will be cleared completely and search restarted, or the
search keeps going
and some already found elements are selectively 'revoked'.

Kris

On Mon, Nov 3, 2014 at 6:07 AM, Alter [email protected] wrote:

I had used the below code to search the result from your code ,but It
cannot search the result firstly the "contentProvider" object is empty,but
if you invoked these code secondly ,it will get the search result .it's
very strange .

QuickTextQuery newFilter = createFilter();
System.out.println("search content is:"+newFilter);
if (this.searcher==null) {
if (!newFilter.isTrivial()) {
searcher = new QuickTextSearcher(newFilter, context.createPriorityFun(),
new QuickTextSearchRequestor(){
@OverRide https://github.com/Override
public void add(LineItem match) {
System.out.println("QuickTextSearchRequestor add
function..."+contentProvider.getNumberOfElements());
contentProvider.add(match);
smallProvider.add(match);
myitem.add(match);
contentProvider.refresh();
}

                    @Override
                    public void clear() {
                        System.out.println("QuickTextSearchRequestor clear function...");
                        contentProvider.reset();
                        contentProvider.refresh();
                    }
                    @Override
                    public void revoke(LineItem match) {
                         System.out.println("QuickTextSearchRequestor revoke function...");
                         contentProvider.remove(match);
                         contentProvider.refresh();
                    }
                    @Override
                    public void update(LineItem match) {
                        contentProvider.refresh();
                    }
              });


     }
  }else {
        //The QuickTextSearcher is already active update the query
        this.searcher.setQuery(newFilter);
   }

   if (progressJob!=null) {
        progressJob.schedule();
    }
 System.out.println("content find is:"+contentProvider.getNumberOfElements()+",content are :\n"+contentProvider.items.toString());


Reply to this email directly or view it on GitHub
#11 (comment)
.

from eclipse-integration-commons.

alterhu2020 avatar alterhu2020 commented on May 5, 2024

@kdvolder ,
thanks very much for your support .i had researched your code and now implement in my plugin .
it's really very awesome with 'asynchronous" status to check the result ....

thanks for your guys .i will under your plugin license for my plugin ...

Alter

from eclipse-integration-commons.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.