Pass through to provider GradeEntrySearchSession.get_grade_entries_by_search
6679
def get_grade_entries_by_search(self, grade_entry_query, grade_entry_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_grade_entries_by_search(grade_entry_query, grade_entry_search)
357877
static String [] searchArchiveForClasses( URL url ) throws IOException {
        List<String> list = new ArrayList<>();
        ZipInputStream zip = new ZipInputStream(url.openStream());

        ZipEntry ze;
        while( zip.available() == 1 )
            if ( (ze = zip.getNextEntry()) != null
                    && isClassFileName( ze.getName() ) )
                list.add( canonicalizeClassName( ze.getName() ) );
        zip.close();

        return list.toArray( new String[list.size()] );
    }
157446
def view_entries(search_query=None):
    """"""
    query = Entry.select().order_by(Entry.timestamp.desc())
    if search_query:
        query = query.where(Entry.content.contains(search_query))

    for entry in query:
        timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p')
        print(timestamp)
        print('=' * len(timestamp))
        print(entry.content)
        print('n) next entry')
        print('d) delete entry')
        print('q) return to main menu')
        action = raw_input('Choice? (Ndq) ').lower().strip()
        if action == 'q':
            break
        elif action == 'd':
            entry.delete_instance()
            break
622343
def get_gradebooks(self):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinLookupSession.get_bins_template
        catalogs = self._get_provider_session('gradebook_lookup_session').get_gradebooks()
        cat_list = []
        for cat in catalogs:
            cat_list.append(Gradebook(self._provider_manager, cat, self._runtime, self._proxy))
        return GradebookList(cat_list)
215361
public SearchResults query(WaybackRequest wbRequest)
			throws ResourceIndexNotAvailableException,
			ResourceNotInArchiveException, BadQueryException,
			AccessControlException {
		SearchResults results = null; // return value placeholder

		if (wbRequest.isReplayRequest()) {

			results = doCaptureQuery(wbRequest, TYPE_REPLAY);
			results.putFilter(WaybackRequest.REQUEST_TYPE, 
					WaybackRequest.REQUEST_REPLAY_QUERY);

		} else if (wbRequest.isCaptureQueryRequest()) {

			results = doCaptureQuery(wbRequest, TYPE_CAPTURE);
			results.putFilter(WaybackRequest.REQUEST_TYPE, 
					WaybackRequest.REQUEST_CAPTURE_QUERY);

		} else if (wbRequest.isUrlQueryRequest()) {

			results = doUrlQuery(wbRequest);
			results.putFilter(WaybackRequest.REQUEST_TYPE, 
					WaybackRequest.REQUEST_URL_QUERY);

		} else {

			throw new BadQueryException("Unknown query type, must be " 
					+ WaybackRequest.REQUEST_REPLAY_QUERY
					+ ", " + WaybackRequest.REQUEST_CAPTURE_QUERY 
					+ ", or " + WaybackRequest.REQUEST_URL_QUERY);
		}
		return results;
	}
818135
@Override
	public void search(
		String[] words,
		WebSiteRequest req,
		HttpServletResponse response,
		List<SearchResult> results,
		AoByteArrayOutputStream bytes,
		List<WebPage> finishedPages
	) {
	}
630289
def search(index, query, snippet_folder=SNIPPET_FOLDER, term_freq=term_freq):
    
    fallback_log = []
    code_list = []
    tokens = tokenize(query)
    tokens, abbr_log = abbr_expand(tokens)
    tokens, correct_log = correct(tokens, term_freq)
    tokens = lemmatize(tokens)
    tokens = filterout(tokens)
    while len(tokens) > 0: # Fallback mechanism
        code_list = fetch(index, tokens)
        if len(code_list) > 0:
            break
        tokens.sort(key=lambda tk:len(index.get(tk, [])))
        remove = tokens.pop()
        fallback_log.append(remove)
    snippets = get_snippets(code_list, snippet_folder)
    hints, hint_scores = get_hints(code_list, current_tokens=tokens)
    response = list(zip(code_list, snippets))
    response.sort(key=result_sort_key, reverse=True)

    # Count search_frequency
    if len(response) <= MAX_RESULT: # the respone can be shown in one page
        search_freq.update(code_list)
        with open(SEARCH_FREQ_JSON, 'w') as f:
            json.dump(search_freq, f, indent=2)

    return response, tokens, hints, hint_scores, \
           abbr_log, correct_log, fallback_log
1169002
function (suggestions, textEntry) {
                var matchValueIndex = -1, suggestion;
                for (var index = 0, len = suggestions.length, label, ariaLabel; index < len; index += 1) {
                    suggestion = suggestions[index];
                    // if it's the first exact match, store it
                    if (matchValueIndex == -1) {
                        if (suggestion.exactMatch) {
                            matchValueIndex = index;
                        }
                    }
                    label = this._getLabelFromSuggestion(suggestion);
                    ariaLabel = this.waiSuggestionAriaLabelGetter ? this.waiSuggestionAriaLabelGetter({
                        value: suggestion,
                        index: index,
                        total: len
                    }) : null;
                    var tmp = {
                        entry : textEntry,
                        label : label,
                        ariaLabel : ariaLabel,
                        value : suggestion
                    };
                    suggestions[index] = tmp;
                }
                return this.preselect === "none" ? -1 : matchValueIndex;
            }
641830
def get_qualifiers_by_search(self, qualifier_query, qualifier_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_qualifiers_by_search(qualifier_query, qualifier_search)
1298141
def get_assets_by_search(self, asset_query, asset_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_assets_by_search(asset_query, asset_search)
306563
final public void standardSearch(
		String[] words,
		WebSiteRequest req,
		HttpServletResponse response,
		List<SearchResult> results,
		AoByteArrayOutputStream bytes,
		List<WebPage> finishedPages
	) throws ServletException, IOException, SQLException {
		if(!finishedPages.contains(this)) {
			String title = null;
			String description = null;
			String author = null;

			// The counted matches will go here
			int totalMatches = 0;
			int size;

			// Search the byte data only if not able to index
			long mySearchLastModified = getSearchLastModified();
			if (mySearchLastModified == -1) {
				title = getTitle();
				description = getDescription();
				author = getAuthor();
				String keywords = getKeywords();

				// Get the HTML content
				bytes.reset();
				ChainWriter out = new ChainWriter(bytes);
				try {
					doGet(out, null, response);
				} finally {
					out.flush();
					out.close();
				}
				byte[] content = bytes.getInternalByteArray();
				size = bytes.size();

				int len = words.length;
				for (int c = 0; c < len; c++) {
					String word = words[c];
					int wordMatch =
						// Add the keywords with weight 10
						StringUtility.countOccurrences(keywords, word) * 10

						// Add the description with weight 5
						+StringUtility.countOccurrences(description, word) * 5

						// Add the title with weight 5
						+StringUtility.countOccurrences(title, word) * 5

						// Add the content with weight 1
						+StringUtility.countOccurrences(content, size, word)

						// Add the author with weight 1
						+StringUtility.countOccurrences(author, word);

					if (wordMatch == 0) {
						totalMatches = 0;
						break;
					}
					totalMatches += wordMatch;
				}

				if (totalMatches > 0) {
					size += keywords.length() + description.length() + title.length() + author.length();
				}
			} else {
				// Rebuild the search index if no longer valid
				if (mySearchLastModified != this.searchLastModified) {
					// Only synchronize for index rebuild
					synchronized (this) {
						if (mySearchLastModified != this.searchLastModified) {
							title = getTitle();
							description = getDescription();
							author = getAuthor();
							String keywords = getKeywords();

							// Get the HTML content
							bytes.reset();
							ChainWriter out = new ChainWriter(bytes);
							try {
								doGet(out, null, null);
							} catch(NullPointerException err) {
								getLogger().log(Level.WARNING, null, err);
							} finally {
								out.flush();
								out.close();
							}
							byte[] bcontent = bytes.getInternalByteArray();
							size = bytes.size();
							String content = new String(bcontent, 0, size);

							// Remove all the indexed words
							searchWords.clear();
							searchCounts.clear();

							// Add the keywords with weight 10
							addSearchWords(keywords, 10);

							// Add the description with weight 5
							addSearchWords(description, 5);

							// Add the title with weight 5
							addSearchWords(title, 5);

							// Add the content with weight 1
							addSearchWords(content, 1);

							// Add the author with weight 1
							addSearchWords(author, 1);

							searchByteCount = size + keywords.length() + description.length() + title.length() + author.length();
							//searchWords.trimToSize();
							//searchCounts.trimToSize();
							this.searchLastModified = mySearchLastModified;
						}
					}
				}

				// Count the words from the index
				int searchWordsSize = searchWords.size();

				int len = words.length;
				for (int c = 0; c < len; c++) {
					String word = words[c];

					// Count through each word
					int wordMatch = 0;
					for (int d = 0; d < searchWordsSize; d++) {
						String searchWord = searchWords.get(d);
						int count = StringUtility.countOccurrences(searchWord, word);
						if (count > 0) wordMatch += count * searchCounts.get(d)[0];
					}

					if (wordMatch == 0) {
						totalMatches = 0;
						break;
					}
					totalMatches += wordMatch;
				}

				// Use the cached size
				size = searchByteCount;
			}

			if (totalMatches > 0) {
				float probability=
					totalMatches
					/ (
						size <= 0
						? 1.0f :
						((float)Math.log(size))
					)
				;
				results.add(
					new SearchResult(
						req.getContextPath()+req.getURL(this),
						probability,
						title == null ? getTitle() : title,
						description == null ? getDescription() : description,
						author == null ? getAuthor() : author
					)
				);
			}

			// Flag as done
			finishedPages.add(this);

			// Search recursively
			WebPage[] myPages = getCachedPages(req);
			int len = myPages.length;
			for (int c = 0; c < len; c++) myPages[c].search(words, req, response, results, bytes, finishedPages);
		}
	}
646287
function handleSearchText(searchText, previousSearchText) {
      self.index = -1;
      // do nothing on init
      if (searchText === previousSearchText) return;
      else if (self.selectedItem && self.displayProperty1) {
        setLoading(false);
        if (self.selectedItem[self.displayProperty1] !== searchText) {
          self.selectedItem = null;
          self.hidden = shouldHide();
          if (self.itemList && self.itemListCopy) {
            self.itemList = angular.copy(self.itemListCopy);
          }
        }
      }
      else if (self.remoteMethod) {
        fetchResults(searchText);
      }
      else if (self.itemList) {
        self.itemList = $filter('filter')(self.itemListCopy, searchText);
      }
    }
957597
@Override
    public SearchResults getSearchResults(PortletRequest request, SearchRequest query) {

        final String queryString = query.getSearchTerms().toLowerCase();
        final List<IPortletDefinition> portlets =
                portletDefinitionRegistry.getAllPortletDefinitions();

        final HttpServletRequest httpServletRequest =
                this.portalRequestUtils.getPortletHttpRequest(request);

        final SearchResults results = new SearchResults();
        for (IPortletDefinition portlet : portlets) {
            if (this.matches(
                    queryString,
                    new MarketplacePortletDefinition(
                            portlet, this.marketplaceService, this.portletCategoryRegistry))) {
                final SearchResult result = new SearchResult();
                result.setTitle(portlet.getTitle());
                result.setSummary(portlet.getDescription());
                result.getType().add("marketplace");

                final IPortletWindow portletWindow =
                        this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(
                                httpServletRequest, portlet.getFName());
                // portletWindow is null if user does not have access to portlet.
                // If user does not have browse permission, exclude the portlet.
                if (portletWindow != null
                        && authorizationService.canPrincipalBrowse(
                                authorizationService.newPrincipal(
                                        request.getRemoteUser(), EntityEnum.PERSON.getClazz()),
                                portlet)) {
                    final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
                    final IPortalUrlBuilder portalUrlBuilder =
                            this.portalUrlProvider.getPortalUrlBuilderByPortletFName(
                                    httpServletRequest, portlet.getFName(), UrlType.RENDER);
                    final IPortletUrlBuilder portletUrlBuilder =
                            portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
                    portletUrlBuilder.setWindowState(PortletUtils.getWindowState("maximized"));
                    result.setExternalUrl(portalUrlBuilder.getUrlString());

                    PortletUrl url = new PortletUrl();
                    url.setType(PortletUrlType.RENDER);
                    url.setPortletMode("VIEW");
                    url.setWindowState("maximized");
                    PortletUrlParameter actionParam = new PortletUrlParameter();
                    actionParam.setName("action");
                    actionParam.getValue().add("view");
                    url.getParam().add(actionParam);
                    PortletUrlParameter fNameParam = new PortletUrlParameter();
                    fNameParam.setName("fName");
                    fNameParam.getValue().add(portlet.getFName());
                    url.getParam().add(fNameParam);
                    result.setPortletUrl(url);
                    // Add the result to list to return
                    results.getSearchResult().add(result);
                }
            }
        }
        return results;
    }
285338
def get_grade_entry_form(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceAdminSession.get_resource_form_for_update
        # This method might be a bit sketchy. Time will tell.
        if isinstance(args[-1], list) or 'grade_entry_record_types' in kwargs:
            return self.get_grade_entry_form_for_create(*args, **kwargs)
        else:
            return self.get_grade_entry_form_for_update(*args, **kwargs)
326695
@Override
    public PagedSearchResult discoverSearch(UploadSearchParams uploadSearchParams) {
        try {
            return postImageSearch(uploadSearchParams, ENDPOINT_DISCOVER_SEARCH);
        } catch (InternalViSearchException e) {
            return new PagedSearchResult(e.getMessage(), e.getCause(), e.getServerRawResponse());
        }
    }
1310811
def search(self, term=None, category=None, pages=1, url=search_url,
				sort=None, order=None):
		""""""

		if not self.current_url:
			self.current_url = url

		if self.current_url == Search.base_url:
			# Searching home page so no formatting
			results = self._get_results(self.current_url)
			self._add_results(results)
		else:

			search = self._format_search(term, category)
			sorting = self._format_sort(sort, order)

			# Now get the results.
			for i in range(pages):
				results = self._get_results(search + "/" + str(self._current_page) +
											"/" + sorting)
				self._add_results(results)
				self._current_page += 1
			self._current_page -= 1
542004
private int getResultsDisplayed(CmsGallerySearchBean searchObj) {

        int resultsDisplayed = searchObj.getMatchesPerPage() * searchObj.getLastPage();
        return (resultsDisplayed > searchObj.getResultCount()) ? searchObj.getResultCount() : resultsDisplayed;
    }