Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None

      Description

      With a few simple changes, solr can be an easily embedded in a custom jetty app.

      With this patch, one can run solr from the jar file using:

      server = new Server( port );

      // Initalize home (without JNDI)
      Config.setInstanceDir(home);

      // Initalize the servlets
      Context root = new Context( server, "/", Context.SESSIONS );
      root.addServlet( SolrServlet.class, "/select" );
      root.addServlet( SolrUpdateServlet.class, "/update" );
      root.addFilter( SolrDispatchFilter.class, "*", Handler.REQUEST );

      1. SOLR-149-embeddable.patch
        4 kB
        Ryan McKinley
      2. SOLR-149-embeddable.patch
        7 kB
        Ryan McKinley
      3. SOLR-149-embeddable.patch
        9 kB
        Ryan McKinley

        Activity

        Hide
        Hoss Man added a comment -

        This bug was modified as part of a bulk update using the criteria...

        • Marked ("Resolved" or "Closed") and "Fixed"
        • Had no "Fix Version" versions
        • Was listed in the CHANGES.txt for 1.2

        The Fix Version for all 39 issues found was set to 1.2, email notification
        was suppressed to prevent excessive email.

        For a list of all the issues modified, search jira comments for this
        (hopefully) unique string: 20080415hossman2

        Show
        Hoss Man added a comment - This bug was modified as part of a bulk update using the criteria... Marked ("Resolved" or "Closed") and "Fixed" Had no "Fix Version" versions Was listed in the CHANGES.txt for 1.2 The Fix Version for all 39 issues found was set to 1.2, email notification was suppressed to prevent excessive email. For a list of all the issues modified, search jira comments for this (hopefully) unique string: 20080415hossman2
        Hide
        Yonik Seeley added a comment -

        Committed. Thanks Ryan!

        Show
        Yonik Seeley added a comment - Committed. Thanks Ryan!
        Hide
        Ryan McKinley added a comment -

        adding the path to the request context so handlers can use it and we can make a nice debug string

        Show
        Ryan McKinley added a comment - adding the path to the request context so handlers can use it and we can make a nice debug string
        Hide
        Ryan McKinley added a comment -

        Modified SolrDispatchFilter to take two startup arguments
        1. "handle-select"
        2. "path-prefix"

        The "handle-select" parameter lets the DispatchFilter take care of /select?qt=XXX in addition to the path based handlers. This is good because the DispatchFilter returns proper error codes.

        "path-prefix" makes it easy to apply the filter to something other then /* in web.xml. For example, you could set this up to run at:

        <filter>
        <filter-name>SolrRequestFilter</filter-name>
        <filter-class>o.a.s.servlet.SolrDispatchFilter</filter-class>
        <init-param>
        <param-name>path-prefix</param-name>
        <param-value>/xxx</param-value>
        </init-param>
        </filter>
        <filter-mapping>
        <filter-name>SolrRequestFilter</filter-name>
        <url-pattern>/xxx/*</url-pattern>
        </filter-mapping>
        </filter>

        Show
        Ryan McKinley added a comment - Modified SolrDispatchFilter to take two startup arguments 1. "handle-select" 2. "path-prefix" The "handle-select" parameter lets the DispatchFilter take care of /select?qt=XXX in addition to the path based handlers. This is good because the DispatchFilter returns proper error codes. "path-prefix" makes it easy to apply the filter to something other then /* in web.xml. For example, you could set this up to run at: <filter> <filter-name>SolrRequestFilter</filter-name> <filter-class>o.a.s.servlet.SolrDispatchFilter</filter-class> <init-param> <param-name>path-prefix</param-name> <param-value>/xxx</param-value> </init-param> </filter> <filter-mapping> <filter-name>SolrRequestFilter</filter-name> <url-pattern>/xxx/*</url-pattern> </filter-mapping> </filter>
        Hide
        Brian Whitman added a comment -

        Using this in a Java / Cocoa bridge, it's gorgeous. Thanks Ryan.

        Show
        Brian Whitman added a comment - Using this in a Java / Cocoa bridge, it's gorgeous. Thanks Ryan.
        Hide
        Yonik Seeley added a comment -

        Cool!

        Show
        Yonik Seeley added a comment - Cool!
        Hide
        Ryan McKinley added a comment -

        This patch

        1. Adds "isInstanceDirInitalized()" to Config
        2. SolrDispatchFilter only initalizes the directory if it is not already set
        3. Adds a function to SolrDispatchFilter that can be easily extended to put custom attributes in the SolrQueryRequest context

        Show
        Ryan McKinley added a comment - This patch 1. Adds "isInstanceDirInitalized()" to Config 2. SolrDispatchFilter only initalizes the directory if it is not already set 3. Adds a function to SolrDispatchFilter that can be easily extended to put custom attributes in the SolrQueryRequest context

          People

          • Assignee:
            Unassigned
            Reporter:
            Ryan McKinley
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development