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

  • Home
  • SEARCH
  • 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 7685467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:15:28+00:00 2026-05-31T19:15:28+00:00

i’m using solr+haystack(django plugin) on the backend and the search is working fine; While

  • 0

i’m using solr+haystack(django plugin) on the backend and the search is working fine;

While Django(and Haystack) with its templates is doing everything for me(I mean its pretty simple to configure and use), ExtJS4 is a little more complex;

The question is how to use Solr using ExtJS4?

An example is very much appreciated;
Thanks for any help and sorry for my English;

  • 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-05-31T19:15:29+00:00Added an answer on May 31, 2026 at 7:15 pm

    As ExtJS4 is a MVC framework, the solution is done like MVC;

    The controller/Search.js

    Ext.define('yourapp.controller.Search',{
    extend:'Ext.app.Controller',
    
    stores:[
        'Searches'
    ],
    
    views:[
        'search.Search',
        'search.SearchList'
    ],
    
    models:[
        'Search'
    ],
    
    init:function(){
        this.control({
            "search":{
                'keyup':this.search,                
            },
        });
    },
    
    search:function(inputedTxt, e, eOpts){
        this.getSearchesStore().load({
            //When sending a request, q will rely to request.POST['q'] on server-side;
            //inputedTxt.getValue() -- a value, entered in textfield (or whatever)
            params:{
                q:inputedTxt.getValue()
            },
            callback:function(result){
                if(result[0]){
                    //do something with the result
                    //i'd been creating a window with a grid inside. "Grid"'s view is written below.
                }
            }               
        }
    });
    

    The models/Search.js

    Ext.define('yourapp.model.Search',{
        extend:'Ext.data.Model',
    
        fields:[
            {name:'name',   type:'string'}
        ]   
    });
    

    The store/Searches.js

    Ext.define('yourapp.store.Searches',{
    extend:'Ext.data.Store',
    storeId: "searchStore",
    
    model:'yourapp.model.Search',
    
    autoLoad: false,
    
    proxy:{
        type:'ajax',
        // server-side url
        url: '/searchlist/',
    
        actionMethods:{create: "POST", read: "POST", update: "POST", destroy: "POST"},
        reader:{
            type:'json',
            root:'searches'
        }
    }
    });
    

    The view/search/Search.js

    //a Text field to input text;
    Ext.define('yourapp.view.search.Search',{
    extend:'Ext.form.field.Text',
    alias: 'widget.search',
    id:    "searchView",
    
    enableKeyEvents: true,
    initComponent:function(){
        this.callParent(arguments);     
    }
    });
    

    The view/search/SearchList.js

    //a view for a result
    Ext.define('yourapp.view.search.SearchList',{
    extend: 'Ext.grid.Panel',
    
    alias:'widget.searchlist',
    title: 'search result',
    store: 'Searches',
    
    columns:[
            { 
            header:'Name', 
            dataIndex:'name',
            flex:1                      
        }
    ]
    });
    

    Somewhere in the view/Viewport.js xtype: 'search', should be inserted for a text field to be displayed.

    That’s all for a ExtJS4 part.


    On server-side — Django:
    ‘haystack’ and Solr should be installed and configured (by ‘configured’ i mean: search should already work on the server-side);

    In someapp/view.py

    def searchlist(request):    
        from haystack.query import SearchQuerySet
        # POST["q"] should be receivedt from our client-side
        searchText = request.POST["q"]
    
        sqs = SearchQuerySet().filter(name=searchText)
    
        data = []
        for result in sqs:            
            data.append({"name": result.object.name})
    
    return HttpResponse('{ success:true, searches:'+simplejson.dumps(data)+'}', mimetype = 'application/json')
    

    Finally in your urls.py you should add:

    (r'^searchlist/','someapp.views.searchlist'),

    That was for it. Best wishes.

    P.S.
    I know this is not the greatest answer and there’s lack of explanation, but as for me, I rather prefer a code example than verbal explanation.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.